feat: support enum split microflow statements#364
Open
hjotha wants to merge 2 commits intomendixlabs:mainfrom
Open
feat: support enum split microflow statements#364hjotha wants to merge 2 commits intomendixlabs:mainfrom
hjotha wants to merge 2 commits intomendixlabs:mainfrom
Conversation
Symptom: enumeration decision splits could not be represented as first-class MDL, so describe/exec round-trips either collapsed them into boolean-looking splits or lost the enumeration case structure. Root cause: the microflow AST, parser, visitor, builder, describer, validator, and reference collectors only modeled boolean IF-style exclusive splits. Sequence flows with EnumerationCase values had no statement form. Fix: add a split enum statement with case/else bodies, emit and parse enumeration case values, build ExpressionSplitCondition graphs with EnumerationCase flows, describe existing enum split graphs back to MDL, and teach validation/layout/terminality/reference walks to recurse through enum branches. Tests: added parser, builder, describer, terminality, and validation regression tests plus a doctype fixture checked with mxcli check. Also ran make build, make lint-go, and make test.
36 tasks
Symptom: an enum split branch containing a nested empty-then decision could round-trip to an MPR whose outgoing decision flow lacked the boolean case value, causing Mendix mx check CE0079/CE0773 even when the described MDL was stable. Root cause: addEnumSplit consumed flowBuilder.nextConnectionPoint from the nested decision but dropped flowBuilder.nextFlowCase before wiring the branch continuation to the shared enum merge. Fix: carry the pending case value through enum branch continuation wiring and reapply it when connecting to the next statement or enum merge. Tests: add a builder regression for a nested empty-then enum branch that must keep CaseValue=true on the continuation flow.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds first-class MDL support for enumeration decision splits in microflows:
Root Cause
The existing microflow model only had a boolean IF representation for exclusive splits. Studio Pro enumeration decisions are also exclusive splits, but their outgoing sequence flows carry
EnumerationCasevalues. Without a dedicated MDL statement, describe/exec round-trips cannot preserve those case values cleanly.Fix
EnumSplitStmtandEnumSplitCaseto the microflow AST.split enumwith multi-value cases and optionalelse.ExpressionSplitConditiongraphs withEnumerationCasesequence flows.split enumsyntax.Validation
go test ./mdl/visitor -run TestEnumSplit -count=1go test ./mdl/executor -run 'Test(EnumSplit|TraverseFlow_EnumSplit|LastStmtIsReturn_EnumSplit|ValidateMicroflow_EnumSplit)' -count=1./bin/mxcli check mdl-examples/doctype-tests/enum_split_statement.test.mdlmake buildmake lint-gomake testCloses #347
Part of #332